<?php
class ProductController extends Zend_Controller_Action {
	
	public function init() {
		$this->log = Zend_Registry::get('log');
		//$this->product = new Macys_Api_V3_Catalog_Product();
	}
	
	
	
	public function getproductAction() {
		//var_dump($this->product->getProduct(45));
		$this->getHelper('viewRenderer')->setNoRender();
	}
	
	public function v2productdetailsAction() {
		$form = new Macys_Form_V2Product();
		$prod = new Macys_Api_V2_Catalog_Product();
		$request = $this->getRequest();
		
		if ($this->_request->isPost()) {
			$formData = $this->_request->getPost();
			if ($form->isValid($formData)) {
				$prod->processInputParams($formData);
				$prod->run();
			}
			$form->populate($formData);
		}
		else {
			$prod->processInputParams($request->getParams());
			$prod->run();
			$form->populate($request->getParams());
		}
		$x = $prod->getRawData();
		//echo "<pre>";
		//print_r($x);
		if(isset($x['products']))
		$this->view->products = $x['products'];
		$this->view->form = $form;
	}
	
	
}